﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpTrack.Data.Test.Fakes {

    using SharpTrack.Data.Model;

    class FakeProjectRepository : DataAccess.IProjectsRepository {

        public Guid KnowProductId = Guid.NewGuid();

        IQueryable<SharpTrack.Data.Model.Project> _products;

        public FakeProjectRepository() {



            List<Project> productsList = new List<SharpTrack.Data.Model.Project>(10);            

            for (int i = 0; i < 10; i++) {

                Project p = null;

                if (i == 0) {
                    p = new Project(KnowProductId, "product_0");
                    p.CreatedOn = DateTime.Now;
                }
                else {
                    p = new Project(Guid.NewGuid(), "product_" + i);
                    p.CreatedOn = DateTime.Now.AddMonths(i - 1);
                }

                productsList.Add(p);
            }

            _products = productsList.AsQueryable();
        }

        #region IProjectsRepository Members

        public IQueryable<SharpTrack.Data.Model.Project> RetrieveProjects() {
            return _products;
        }     
        #endregion
    }
}
